package ${package.ServiceImpl};

import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import ${superServiceImplClassPackage};
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;

/**
* <p>
    * ${table.comment!} 服务实现类
    * </p>
*
* @author ${author}
* @since ${date}
*/
@Service
<#if kotlin>
open class ${table.serviceImplName} : ${superServiceImplClass}<${entity}>(), ${table.serviceName} {

}
<#else>
public class ${table.serviceImplName} extends ${superServiceImplClass}<${entity}> implements ${table.serviceName} {

@Resource
private  ${table.mapperName}  ${table.mapperSourceName};

@Override
public PageInfo<${table.entityName}> pageQuery(Integer page, Integer num, ${table.entityName} param) {
Page<${table.entityName}> pg = PageHelper.startPage(page, num);
this.getList(param);
return PageInfo.of(pg);
}

@Override
public List<${table.entityName}> getList(${table.entityName} param) {
return ${table.mapperSourceName}.select${table.entityName}List(param);
}

@Override
public void delete${table.entityName}(List
<Long> ids, Long operatorId) {
    ${table.mapperSourceName}.delete${table.entityName}(ids, operatorId);
    }

    @Override
    public void edit${table.entityName}(${table.entityName} newData) {
    LocalDateTime now = LocalDateTime.now();
    if (newData.getId() == null) {
    newData.setGmtCreate(now);
    this.save(newData);
    } else {
    newData.setGmtModified(now);
    this.updateById(newData);
    }
    }
    }
    </#if>
